'''
Created on 2013-1-16

@author: hanchen
'''

def get_charset(html):
    begin = html.find('charset')
    if begin < 0:
        return ''
    begin = begin + 7
    end = html.find('"', begin)
    if end <= begin:
        return ''
    charset = html[begin: end]
    charset = charset.strip()
    return charset
        
